package com.mycompany.lctwitter.persist.dao;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Repository;
import org.springside.modules.orm.hibernate.HibernateDao;

import com.mycompany.lctwitter.persist.model.Footprint;
import com.mycompany.lctwitter.persist.model.Location;
import com.mycompany.lctwitter.persist.model.User;

@Repository("footprintDao")
public class FootprintDao extends HibernateDao<Footprint, Long> {

    public void add(User user, Location location, Date date) {
        Footprint footprint = new Footprint();
        footprint.setUser(user);
        footprint.setLocation(location);
        footprint.setDate(date);
        save(footprint);
    }

    public List<Footprint> list(Long userId) {
        return find("from Footprint fp where fp.user.id=?", userId);
    }

}